package com.mgkj.mapper;


import com.baomidou.dynamic.datasource.annotation.DS;
import com.mgkj.entity.Purth;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface PURTCDMapper {


    @DS("demo")
    @Select("SELECT TD010 FROM PURTD WHERE TD001 = #{TD001} AND TD002 = #{TD002} AND TD003= #{TD003}")
    Double selectOne(@Param("TD001") String TD001,@Param("TD002") String TD002,@Param("TD003") String TD003);

    @DS("demo")
    @Select("SELECT COUNT(TD012) FROM PURTD WHERE " +
            "TD012 < CAST(GETDATE() AS DATE) " +
            "AND TD001 = #{cd010} " +
            "AND TD002 = #{cd011} " +
            "AND TD003 = #{cd012} ")
    Boolean selectCQ(@Param("cd010") String cd010,@Param("cd011") String cd011,@Param("cd012") String cd012);

    @Update("UPDATE PURTD SET TD015 = #{th007} WHERE TD001 = #{th011} AND TD002 = #{th012} AND TD003 = #{th013}")
    int updateTD015(Purth purth);
}
